﻿using System;
using System.Collections.Generic;

using ThingyCloud.Creatures;

namespace ThingyCloud.Network.Messages
{
	class AvatarSplitMessage : Message
	{
		private Avatar newAvatar;
		private Avatar oldAvatar;

		public AvatarSplitMessage(Avatar aNew, Avatar a)
		{
			this.newAvatar = aNew;
			this.oldAvatar = a;
		}

		public override string ToMessageString()
		{
			return string.Format(
					"action:split;oldid:{0};id:{0},{1};crid:{2},{3};var:{4},{5};x:{6},{7};y:{8},{9};r:{10},{11};w:{12},{13};h:{14},{15};",
					oldAvatar.ID,
					newAvatar.ID,
					oldAvatar.Properties.ID,
					newAvatar.Properties.ID,
					oldAvatar.Variant.ID,
					newAvatar.Variant.ID,
					Globals.ToAbsX(oldAvatar.X),
					Globals.ToAbsX(newAvatar.X),
					Globals.ToAbsY(oldAvatar.Y),
					Globals.ToAbsY(newAvatar.Y),
					oldAvatar.Direction,
					newAvatar.Direction,
					oldAvatar.Width,
					newAvatar.Width,
					oldAvatar.Height,
					newAvatar.Height
					);
		}
	}
}
